package com.kpx.app.utils;

import android.content.Context;
import android.text.InputFilter;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.TextView;

import com.kpx.app.R;

/**
 * TextView相关
 *
 * @author Jakc Boy
 */
public class TextViewUtil {
    public final static int SIZE_12 = 12;

    /**
     * 设置最大输入字数
     */
    public static void setMaxInputWords(TextView textView, int size) {
        textView.setFilters(new InputFilter[]{new InputFilter.LengthFilter(size)});
    }


    /**
     * 设置过期文字旋转显示
     */
    public static void setCouponExpiredRotate(Context context, TextView textView) {
        Animation roteteAnim = AnimationUtils.loadAnimation(context, R.anim.rotate_right_45dp_no_duration_anim);
        roteteAnim.setFillAfter(true);
        textView.setAnimation(roteteAnim);
    }

}
